<template>
  <div class="loading" v-show="show">
    <div>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      show: true
    };
  },
  methods: {
    open() {
      this.show = true;
    },
    close() {
      this.show = false;
    }
  }
};
</script>

<style lang="scss" scoped>
.loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  > div {
    height: 0.88rem;
    display: flex;
    justify-content: center;
    align-items: center;
    span {
      display: inline-block;
      width: 2px;
      margin: 0 1px;
      background: #f5f4e3;
      -webkit-animation: load 1s ease infinite;
    }
    @keyframes load {
      0% {
        height: 0.4rem;
        background: #f5f4e3;
      }
      100% {
        height: 0.4rem;
        background: #f5f4e3;
      }
      50% {
        height: 0.6rem;
        margin: -4px 1px;
        background: #fceba8;
      }
    }

    span:nth-child(2) {
      -webkit-animation-delay: 0.2s;
    }

    span:nth-child(3) {
      -webkit-animation-delay: 0.3s;
    }

    span:nth-child(4) {
      -webkit-animation-delay: 0.5s;
    }

    span:nth-child(5) {
      -webkit-animation-delay: 0.7s;
    }
  }
}
</style>
